﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;

namespace FusionDotNet.WorkflowActivities
{
    public sealed class AuthenticateActivity : FusionActivityBase<FusionDotNet.AuthenticationToken, AuthenticationResult>
    {
        [RequiredArgument]
        public InArgument<string> UserName { get; set; }

        [RequiredArgument]
        public InArgument<string> Password { get; set; }

        public override Command<AuthenticationResult> CreateCommand(System.Activities.AsyncCodeActivityContext context)
        {
            return new AuthenticationCommand
                (AccountTypeEnum.Google,
                context.GetValue(UserName),
                context.GetValue(Password),
                "fusiontables",
                "visionforms");
        }

        public override FusionDotNet.AuthenticationToken CreateResult(AuthenticationResult commandResult)
        {
            return commandResult.AuthenticationToken;
        }
    }
}
